package org.suwenqian.audiovideosummary.controller;

import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.suwenqian.audiovideosummary.dto.req.AsrEndReqDTO;
import org.suwenqian.audiovideosummary.dto.req.TranscodeReqDTO;
import org.suwenqian.audiovideosummary.result.Result;
import org.suwenqian.audiovideosummary.service.CallBackService;
import org.suwenqian.audiovideosummary.web.Results;

@RestController
@RequestMapping("/audio-video")
@RequiredArgsConstructor
public class CallBackController {

    private final CallBackService callBackService;

    /**
     * 异步回调 转码后写库
     * @param requestParam 请求参数
     * @return 无返回值
     */
    @PostMapping("/transcodeEnd")
    public Result<Void> transcodeEnd(@RequestBody TranscodeReqDTO requestParam){
        callBackService.transcodeEnd(requestParam);
        return Results.success();
    }


    /**
     * 异步回调 asr后写库 + 调用大模型
     * @param requestParam 请求参数
     * @return 无返回值
     */
    @PostMapping("/asrEnd")
    public Result<Void> asrEnd(@RequestBody AsrEndReqDTO requestParam){
        callBackService.asrEnd(requestParam);
        return Results.success();
    }


}
